Xbasic

Comparison Operators

Description

Comparison operators compare two expressions which must be of the same type (either character, numeric, or date) and will yield a logical result (i.e., TRUE or FALSE). Any expression involving a comparison operator is called a logical expression. Comparison operators are typically used in creating search criteria, filters, or are used with the IF and CASE functions. All comparison operators, except for substring inclusion, can evaluate numeric, date, or character values. For date values, earlier dates have lower values. For character values, the character's corresponding ASCII value is used in the comparison. Alpha Anywhere supports the following comparison operators:

Name
Description
= (Equals Operator)

The Equals operator returns .T. (TRUE) if both Operand1 and Operand2 are of the same type and have the same value, i.e. if the expressions on both sides of the operator are equal.

== (Exactly Matching Operator)

The Exactly Matching operator returns .T. (TRUE) if the expressions on both sides of the operator are the same type and are equal.

> Greater Than

This operator results in TRUE if the expression on the left is greater than the expression on the right.

>= Greater than or Equal to

This operator results in TRUE if the expression on the left is greater than, or equal to, the expression on the right.

< Less Than

This operator results in TRUE if the expression to the left of the operator is less than the expression to the right.

<= Less than or Equal to

This operator results in TRUE if the expression to the left of the operator is less than, or equal to, the expression to the right.

<> Not Equal To

The result is TRUE if the expressions on both sides of the operator are not equal, i.e. if both Operand1 and Operand2 are of different types or have different values.

!= (Not Exactly Matching Operator)

The Not Exactly Matching operator returns .T. (TRUE) if the expressions on both sides of the operator both, Operand1 and Operand2, are of different types or have different values.

!$ (Substring Exclusion Operator)

The !$ operator determines whether the character expression on the left of the operator is not contained anywhere within the character expression on the right.

$ (Substring Inclusion Operator)

The $ operator determines whether the character expression on the left of the operator is contained anywhere within the character expression on the right.

See Also